package com.lzh.chatnote.user.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 *  1改名卡 2徽章
 */
@AllArgsConstructor
@Getter
public enum ItemTypeEnum {
    BADGE(1, "徽章"),
    ITEM(2, "道具"),
    ;
    private final Integer type;
    private final String describe;

    private static final Map<Integer, ItemTypeEnum> cache;

    static {
        cache = Arrays.stream(ItemTypeEnum.values()).collect(Collectors.toMap(ItemTypeEnum::getType, Function.identity()));
    }

    public static ItemTypeEnum of(Integer type) {
        return cache.get(type);
    }
}
